const connection = require('../app/database')

class AuthService {
  async getPermission(tableName,resourceId, id) {
    try {
      const statement = `SELECT * FROM ${tableName} WHERE id = ? AND user_id = ?;`
      const [result] = await connection.execute(statement, [resourceId, id]);
      // console.log(result.length)
      return result.length === 0 ? false : true;

    } catch (e) {
      console.log(e)
    }

  }
}

module.exports = new AuthService()